package com.isoftstone.securityframework.device;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import com.isoftstone.securityframework.api.AccountManager.AuthStatus;
import com.isoftstone.securityframework.api.domain.Account;
import com.isoftstone.securityframework.api.domain.Permission;
import com.isoftstone.securityframework.device.exception.DeviceException;
import com.isoftstone.securityframework.device.domain.Device;
import com.isoftstone.securityframework.device.domain.DeviceGroup;
/**
 * 设备管理接口
 * @author david
 *
 */
public interface DeviceManager {


	Device register(Device Device)throws DeviceException;
	Device register(Device Device,AuthStatus authstatus)throws DeviceException;
	
	Device register(Device Device,Serializable[] groupIds,Serializable[] permissionIds)throws DeviceException;
	Device registerWithPermissions(Device Device,Permission[] permissions)throws DeviceException;
	Device registerWithPermissions(Device Device,Serializable[] permissionIds)throws DeviceException;
	Device registerWithGroups(Device Device,DeviceGroup[] groups)throws DeviceException;
	Device registerWithGroups(Device Device,Serializable[] groupIds)throws DeviceException;
	
	
	Device get(Integer id);
	Device get(String flag);
	List<Device> list();
	List<Device> list(Map<String, Object> params);
	
	
	
	/**
	 * 帐号设备绑定关系维护
	 * @param account
	 * @param Devices
	 */
	void relAccountDevice(Account account,Device[] Devices);
	void relAccountDevice(Account account,Serializable[] DeviceIds);
	void relAccountDevice(Serializable accountId,Serializable[] DeviceIds);

	void unrelAccountDevice(Account account,Device[] Devices);
	void unrelAccountDevice(Account account,Serializable[] DeviceIds);
	void unrelAccountDevice(Serializable accountId,Serializable[] DeviceIds);
	

	/**
	 * 设备授权
	 * 
	 * @param Device
	 * @param permissions
	 */
	void relDevicePermission(Device Device, Permission[] permissions);

	/**
	 * 设备授权
	 * 
	 * @param Device
	 * @param permissions
	 */
	void relDevicePermission(Device termianl, Serializable[] permissionIds);

	/**
	 * 设备授权
	 * 
	 * @param Device
	 * @param permissions
	 */
	void relDevicePermission(Serializable DeviceId, Serializable[] permissionIds);

	/**
	 * 取消设备授权
	 * 
	 * @param Device
	 * @param permissions
	 */
	void unrelDevicePermission(Device Device, Permission[] permissions);

	/**
	 * 取消设备授权
	 * 
	 * @param Device
	 * @param permissions
	 */
	void unrelDevicePermission(Device termianl, Serializable[] permissionIds);

	/**
	 * 取消设备授权
	 * 
	 * @param Device
	 * @param permissions
	 */
	void unrelDevicePermission(Serializable DeviceId,
			Serializable[] permissionIds);
}
